﻿@model ORM.Areas.Admin.ViewModels.ManageCategories.InsertModelCategoryViewModel
@{
    ViewBag.Title = "Create A Model Category";
    ViewBag.MenuGroup = "Categories";
    ViewBag.MenuName = "ManageModelCategories";
    ViewBag.PageHeader = "Create A Model Category";
}
@*@Html.Partial("_ModelCategoryInputForm", Model)*@
@Html.ValidationSummary(true, ValidationMessages.Summary)
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div class="content-box">
    <div class="content-box-header">
        <h3>
            Model Category information</h3>
    </div>
    <div class="content-box-content">
        @using (Html.BeginForm("CreateModelCategory", "ManageCategories", FormMethod.Post, new { enctype = "multipart/form-data", @id = "user-edit-form" }))
        {
          
            @Html.HiddenFor(m => m.Model.Id)
            <div class="input">
                <p class="required">
                    @Html.LabelFor(m => m.Model.Name)
                    @Html.TextBoxFor(m => m.Model.Name, new { @class = "text-input small-input" })
                    @Html.ValidationMessageFor(m => m.Model.Name)
                </p>
                <p>
                    @Html.LabelFor(m => m.Model.Description)
                    @Html.TextBoxFor(m => m.Model.Description, new { @class = "text-input small-input" })
                    @Html.ValidationMessageFor(m => m.Model.Description)
                </p>
                <p>
                    @Html.LabelFor(m => m.Model.DeviceId)
                    @Html.DropDownListFor(m => m.Model.DeviceId, (IEnumerable<SelectListItem>)(ViewBag.Device), new { id = "DeviceId", @style = "width:200px;" })
                    @Html.ValidationMessageFor(model => model.Model.DeviceId)
                </p>
                <p>
                    @Html.LabelFor(m => m.Model.ManufacturerId)
                    @Html.DropDownListFor(m => m.Model.ManufacturerId, (IEnumerable<SelectListItem>)(ViewBag.Manufacturer), new { id = "ManufacturerId", @style = "width:200px;" })
                    @Html.ValidationMessageFor(model => model.Model.ManufacturerId)
                </p>
                <p>
                    <div class="editor-label">
                        @Html.LabelFor(m => m.Model.ImageUrl)
                    </div>
                    <br />
                    <div class="editor-field">
                        <input id="edit-picture-upload" type="file" style="height: 25px" name="file" />
                    </div>
                </p><br/>
                <p>
                    <button class="t-button t-button-icontext save" type="submit">
                        <span class="t-icon t-update"></span>Save</button>
                    <a class="t-button t-button-icontext cancel" href="@Url.Action("ManageModelCategories", "ManageCategories")">
                        <span class="t-icon t-cancel"></span>Cancel</a>
                </p>
            </div>
            
            if (ViewBag.UploadImageError != null)
            {
            <script type="text/javascript">
                if (ViewBag.UploadImageError != null) {
                    alert(ViewBag.UploadImageError);
                }
            </script>
            }
        }
    </div>
</div>
